Finding resource bottlenecks with low-frequency sampled data

ABSTRACT

A method for automatically gauging a benefit of a tuning action. The method including collecting a plurality of observations of a running state of a plurality of threads in a computer system, as executed by a processing in a computer system. Identifying a plurality of resources the computer system and a capacity of each resource of the plurality of resources. Mapping an observation of the running state of each thread of the plurality of threads to a resource that the observation of each thread uses, respectively. Applying the tuning action to a first resource of the plurality of resources to determine an impact on the performance of the computer system.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a continuation of application Ser. No. 13/563,640,filed on Jul. 31, 2012, which claims the benefit of U.S. ProvisionalApplication No. 61/689,795, filed on Jun. 13, 2012.

FIELD OF THE INVENTION

The present application generally relates to a method and apparatus forfinding automatically gauging a benefit of a tuning action, and moreparticularly to a method and apparatus for finding resource bottleneckswith snapshot data.

BACKGROUND

Making decisions about whether the performance of an application can beimproved, and how to go about doing so, is a task that lies at thecrossroads of code optimization and capacity planning. Typically,capacity planning systems attempt to predict performance as a functionof demand for a resource versus the available capacity of the resource,e.g., based on various what-if scenarios, capacity planning systems canpredict changes to response time, and throughput. Performance tuningneeds the same quality of information. Indeed, some performance tuningoperations reconfigure resources in exactly the way that a capacityplanning exercise would simulate, e.g., adding processors or increasingnetwork capacity.

Capacity planning techniques are quite heavy-weight, involving extensivedata collection, modeling and model tuning. For instance, in a typicalcapacity planning exercise the user tries to fit a curve as precisely asthey can. To fit the curve, the user must manually input, into thecapacity planning tool, a list of available resources and the way theyare interconnected, specify their queuing semantics, measure loadcharacteristics, the set of program asks (e.g., Servlets), and estimatesof response time for each of the program tasks. Then follows a period ofmanipulating the inputs (often referred to as the parameter tuning ormodel validation), to ensure a good fit for a predictive formula. Thisis an extremely laborious task that is generally only performed once.

The goal of this exercise is to come up with a response time of thesystem for various what-if scenarios, e.g., given the manually inputresources and constraints, determine that the response time of thesystem will be slower than if an additional resource is added. As aresult, the user must baby sit the system through a period of curvefitting. In addition, this approach treats the problem as a black boxand does not inform the user of how a bottleneck in the systemoriginated.

Likewise, conventional performance tuning tools simply look for hotcalling contexts. However, it is difficult to determine if calling oneportion of code more than another is actually a problem. This is becauseperformance tuning tools ignore the realities of the systems on whichthe code executes.

By way of example, if a resource, e.g., a CPU, is saturated and 100threads are waiting on 4 threads to execute a database access,conventional performance tuning tools would simply attempt to increase aspeed of a database access, however, this approach ignores that the CPUis saturated and will just increase pressure on the saturated CPUwithout improving overall performance.

That is, increasing the performance of a first operation can, and oftendoes, cause a second operation to perform more slowly due to the factthat the second operation now has to share a resource with the firstoperation. This is often referred to as a zero-sum gain.

Due to the fact that conventional capacity planning and performancetuning tools evaluate changes in system performance from the variouswhat-if scenarios based on a queuing model, they are heavily timedependent and rely on queuing theory. That is, they require simulationof the application on top of the queuing model. Therefore, these toolsare not useful for identifying performance problems based on varioussnapshots of the system at points in time.

As a result, they carry the burden of inspecting the consequences ofevery change to the system to remain current. Accordingly, they carry alarge burden of adapting to changes in the performance landscape ofvarious resources. Axiomatically, conventional capacity planning andperformance tuning tools are not useful for providing a lightweightsolution for triaging performance problems as they arise throughout theevolution of the system.

BRIEF SUMMARY

In view of the foregoing and other exemplary problems, drawbacks, anddisadvantages of the conventional methods and structures of conventionalcapacity planning and performance tuning tools, an exemplary feature ofthe present invention is to provide a method and structure in which aprimary resource bottleneck can be automatically detected (found)without requiring any user defined parameters.

The method and system of the present disclosure may include identifyinga primary resource bottleneck. The method and system may also includegenerating a queuing network model with no manual input from the user.The method and system may also include automatically figuring out wherea primary resource bottleneck is located in the computer system. Themethod and system may include generating a set of prioritized tuningactions. The method and system may also include generating a next tuningaction choice based on a determination of whether or not a tuning actionis determined to be low-priority due to a latent bottleneck in thesystem. The system and method may include generated a plurality ofqueuing network models. The system and method may include generating aqueuing network model for each snapshot.

A computer readable storage medium storing a program of instructionsexecutable by a machine to perform one or more methods described hereinmay be provided.

Further features as well as the structure and operation of variousembodiments are described in detail below with reference to theaccompanying drawings. In the drawings, like reference numbers indicatedidentical or functionally similar elements.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The foregoing and other exemplary purposes, aspects and advantages willbe better understood from the following detailed description ofexemplary embodiments of the invention with reference to the drawings,in which:

FIG. 1 illustrates an exemplary method of one embodiment of the presentinvention;

FIG. 2A illustrates an example of a consumption relation of an instanceof a resource acquisition graph of an exemplary embodiment of thepresent disclosure;

FIG. 2B illustrates the resource acquisition graph of FIG. 2A havingbeen populated with tokens;

FIG. 3 illustrates an exemplary method of the embodiment of FIG. 1;

FIGS. 4A, 4B illustrate another exemplary embodiment of the embodimentof FIG. 3; and

FIGS. 5A, 5B illustrate a typical hardware configuration and storagemedia in which the systems and methodologies of the present disclosuremay be carried out or executed.

DETAILED DESCRIPTION

Referring now to the drawings, and more particularly to FIGS. 1-5B,there are shown exemplary embodiments of the method and structuresaccording to the present invention.

The system and method (also referred collectively as a methodology) inone exemplary aspect of the present disclosure may identify a primarybottleneck in a computer system without using user defined parameters.In the methodology of the present disclosure the system and method maygauge a benefit of a tuning action. In the methodology of the presentdisclosure, in one exemplary embodiment, generates an instance of aqueuing network model from a running application and calculates anexpected benefit of one or more tuning actions. Specifically, themethodology of the present disclosure in one exemplary embodimentdetermines the effect of one or more tuning actions on the queuingnetwork model.

A methodology is presented in the present disclosure in an exemplaryembodiment that infers behavior based on snapshots of the runningapplication. The methodology may analyze performance effectively basedon lightweight, non-intrusive snapshot information available by default,for example, from standard Java™ Virtual Machines (JVMs) and operatingsystems. In the methodology of the present disclosure, a snapshot of arunning system comprises the call stack for every thread in theapplication and the lock graph; that is, what threads hold what locksand what threads are waiting on what locks. For most production JVMs(including IBM and Oracle), snapshots can be obtained from running Javaapplications by sending a kill −3 signal to the JVM.

However, it should be understood that the methodology of the presentdisclosure is not limited only to snapshots. Any mechanism thataggregates the state of threads and locks is appropriate. Furthermore,the methodology of the present disclosure does not need to restart,recompile, change command line arguments to the application, changeenvironment variables, or otherwise modify the running application, morereadily allowing for wide-scale adoption of the methodology

FIG. 1 illustrates an exemplary embodiment of the present disclosure.The system automatically identifies a primary bottleneck in a computersystem without requiring any user defined parameters. Referring to FIG.1, an application is running at 102. There may be a plurality ofapplications running in the computer system, for instance, to performone or more desired functions. The system and method of the presentdisclosure need not specifically run or start an application. Rather,the system and method of the present disclosure may work from datacollected about the already running application on one or more computersystems.

At step 104, snapshots of the running application may be acquired. Theacquired snapshots may be referred to as stack samples 106 herein.

At step 108, hardware and software resources may be associated with thestack samples 106 acquired at step 104 to generate the ResourceConsumption Relation 110.

By using snapshots, rather than more complete traces, an exemplaryembodiment of the present disclosure can provide sufficient informationfor performance tuning, with considerably lower overhead when comparedwith conventional performance tuning tools. For instance, at step 104,the present methodology may acquire information about runtime executionof the computer system and running application, including but notlimited to, snapshots or like system dumps.

More specifically, at step 104, the methodology of the presentdisclosure may acquire a snapshot of a call stack associated with eachthread. The snapshot may include the current method invocation of eachextant thread, at the discrete moment in time when information wascollected. A plurality of these snapshots may be acquired. The pluralityof snapshots may be acquired at a periodic time interval.

For example, in one exemplary embodiment the snapshots are acquired attime interval of 5 seconds. In another exemplary embodiment, the timeinterval may be every 30 seconds. In other exemplary embodiments thetime interval may be every 15 minutes.

The snapshots may also include information about monitors, e.g., a lockgraph. Briefly, monitors are programming objects that achievesynchronization in concurrent programming. Monitors are implemented suchthat any of its methods are executed at most by one thread at a point intime, i.e., in mutual exclusion. Further, monitors also provide amechanism for threads to temporarily give up an exclusive access, inorder to wait for some condition to be met, before regaining exclusiveaccess and resuming their task. Monitors also have a mechanism forsignaling other threads that such conditions have been met.

Monitor graphs, also referred to as lock graphs in the presentdisclosure, show which threads are waiting on a critical section. Forexample, a lock graph may include information about the current owner ofa critical section of code, and the call stacks that are queued, waitingto enter that critical section of code.

The state of the threads and the lock graph at a moment in time isreferred to as a snapshot in the present disclosure. Each of the callstacks in a snapshot is referred to as an observation in the presentdisclosure. The methodology of the present disclosure, in one exemplaryembodiment, may use built-in mechanisms that are provided by mostproduction Java™ Virtual Machine (JVM), whereby the JVM will respond tosignals and dump relatively small (“javacore”) files with datarepresenting the current JVM state.

In an exemplary embodiment, at step 118, the system and method may infera set of tasks in a program. The set of tasks in a program are referredto as the request types of that program in the present disclosure.Request types may include, for example, Servlets, work units,transaction requests, request phases. That is, request types may includethe phases of a batch application, as well as, the transactions andrequest handlers of a server application. According to one exemplaryembodiment of the present disclosure, at step 118, the request types areinferred from a set of call stack samples 106 acquired at step 104.

In an exemplary embodiment of the present disclosure a rules engine maybe provided at step 118. The rules engine may detect cases of requesttype nesting. For example, a request type, e.g., a single Servlet, mayact as a dispatcher to nested request type, rather than accomplishing afixed task. The rules engine includes in the request type set only thosewrapped units of work, and excludes request types, e.g., the Servlet,whose role is solely one of dispatcher.

At step 108, the system and method of the present disclosure mayassociate one or more observations with a software or hardware resourcethat attempting to consume. In an exemplary embodiment, everyobservation is associated with a software or hardware resource that itis attempting to consume. This association is referred to as aconsumption relation in the present disclosure.

By way of example, the resources may include any number and combinationof a central processing unit (CPU), locks, local data and remote data.The remote data may include multiple distinct sources of remote data,e.g., data from a database server and data from a message queuingservice. One having ordinary skill in the art would understand thatthere may be other resources and that the remote data is not limited tothe aforementioned distinct sources.

As discussed below, the system and method of the present invention mayinfer a resource being consumed based on the consumption relation. Thesystem and method may infer that one resource is waiting on one or moreother resources and, as a result, may infer the degree of consumptionfor each of the resources. Axiomatically, the consumption relation of anapplication can give insight into where tuning efforts should befocused.

In an exemplary embodiment, the consumption relation may also be givendirectly via the lock graph. In this embodiment, the observationswaiting on a critical section of code and the owner of the criticalsection of code each take part in the consumption of that resource,e.g., a lock resource. For other resources, the consumption relation maynot always be directly given. However, the consumption relation may beapproximated.

For instance, managed code interacts with resources by invoking a small,and infrequently changing, set of native methods. Managed code does thisin much the same way that native code interacts with operating systemresources by invoking a small, and infrequently changing, set of systemcalls. Consequently, this periphery of native methods is small, and canbe defined by a likewise small set of mapping rules. These rules relatemethod names to a data source or lock being consumed, and are hencelikely to be idle. Conversely, threads that have no such mapping willlikely be runnable, consuming a share of processor resources.

The system and method of the present disclosure may include a requesttype inference engine at step 118. When an observation has been assigneda request type, the request type inference engine can infer that theobservation is in-request, i.e. that it is in the middle of fulfillingan instance of that request type. Since the set of native peripherymethods sometimes ambiguously identifies the resource being consumed byan observation, this feature is helpful to correctly infer theconsumption relation from the observations.

In contrast, a simple rule that attempts to detect idle worker threads,e.g., by looking for a combination of socketRead and Listener on thestack, often returns false positives. However, in an exemplaryembodiment of the present disclosure, a consumption relation at step 110and may exclude in-request observations from firing such simple rules,thereby achieving a large improvement in the accuracy of the consumptionrelation when compared to the use of simple rules alone. The method andsystem of the present disclosure may also use the in-request proper toinfer other resource consumption states, e.g., threads wanting to joinpoints.

The consumption relation of an application gives insight into where atuning effort should be focused. For example, if the consumptionrelation indicates that a call stack is currently consuming processorresources, then a code tuning action focused on the call stack to reduceits level of CPU consumption might help. The present inventors haverecognized establishing a potential function, e.g., the room forimprovement of an observed level of resource consumption, is helpful infinding primary resource bottlenecks.

That is, in contrast to conventional performance tuning tools, thesystem and method of the present disclosure may establish a metric forimproving the observed level of resource consumption. Conventionalperformance tuning tools, on the other hand, focus on hot methods andmeasure the badness of a call stack based on the number of times thestack was observed to be executing.

By accounting for the capacity of resources when identifying a primarybottleneck the resource acquisition graph of the system and method ofthe present disclosure may use consumes-after information in itsdecisions and therefore does not identify bottlenecks that would have noimpact on the performance of the system.

Referring back to FIG. 1, an exemplary embodiment of the presentdisclosure generates network of nodes (e.g., resources) at step 116.This network of nodes is generated based on the resource consumptionrelation inferred at step 110.

At step 122, monitors are extracted from the stack samples 106. Morespecifically the lock graph information is extracted from the snapshots.Step 122 produces one or more monitor graphs 124, e.g., similar to lockgraph discussed above. Monitor graphs 124 show what threads are waitingon a critical section.

At step 126, edges are generated based on the monitor graphs 124 and therequest type distribution calculated at step 120.

At step 128, a queuing network model, e.g., a resource acquisitiongraph, is generated by combining the nodes generated at 116 and theedges generated at 126 and then inferring an instance of a queuingnetwork model.

That is, just from the samples, the system and method of the presentdisclosure is able to combine the inference of the operation beingperformed along with the inference of the resource being consumed toautomatically construct a resource acquisition graph, e.g., aperformance model or a queuing network model.

In one exemplary embodiment the consumption relation is inferred fromthe call stacks in a sample. For each of the resources of the inferredconsumption relation a node type is assigned.

Specifically, referring to FIG. 2A, an example of a consumption relationof an instance of a resource acquisition graph 300 is provided. Theresources, e.g., 304, 308 and 312, and queues, e.g., 302, 306 and 310,are represented as nodes and the relationship between the consumption ofone resource and another are represented as edges. A sink node 314 isprovided for retiring consumers of the resource connected to the sinknode. The sink node 314 may be connected to any of the resource nodes,however, in an exemplary embodiment the sink node 314 is connected to aCPU node 312. Clearly, the resource acquisition graph is shown forexemplary purposes and not intended to be limiting. That is, otherresources and relationships thereof may be provided based on thesamples.

A resource pool is a set of functionally identical or similar resources,e.g., processors that are shared between threads of computation. Eachresource in the exemplary consumption relation of an instance of aresource acquisition graph 300 may have three properties. For example, aparallel capacity, e.g., a positive real number, a speed of the realnumber, e.g., in a range of [0, 1], and a flavor. The flavor may beeither time-shared, e.g., 308 and 312, or gating, e.g., 304. Everyresource has a corresponding queue, e.g., 302, 306 and 310.

The speed of a resource may affect the time to service a unit of work.For example, a 2 GHz processor may process a unit of work at most twiceas fast as a 1 GHz processor. A resource with greater capacity forparallelism can complete more units of work per unit time. Of note,capacity relates to service time, e.g., capacity dictates the maximumnumber of concurrent consumers (tokens) that can be served withoutsignificant performance degradation.

For example, being optimistic about issues such as false sharing, amachine with 100 processors can serve as many as 100 concurrentconsumers without harming the performance of any one of them. Someresource pools may have soft bounds, including, for example, a processorpool. In an exemplary embodiment of the system and method of the presentdisclosure, such pools have an initial, current, and maximum capacity.During execution, the runtime automatically floats the current boundbetween the initial and maximum bounds, based on demand. In oneexemplary embodiment of the present disclosure, in such a situation themethod and system may assume a maximum bound.

Each capacity bound may be based on either the economics of thesituation, e.g., cost of increasing capacity, or a bound put into placeto limit the degree over-consumption of some other resource pools. When,for example, a resource is saturated, e.g., more consumers thanavailable capacity, the consumers are placed in a queue associated withthat resource. That is, when interaction with a resource pool, threadsof computation either consume a share of the resource or queue up untilthe resource becomes available.

The present disclosure provides distinct rules for time-sharedresources, e.g., 308 and 312, and gating resources, e.g., 304. Forinstance, time-shared resources may allow for concurrent or time-sharedconsumption. Accordingly, time-shared resources, such as, for example,processors, network, and disks, may be multiplexed between all aspiringconsumers of the time-shared resource, resulting in each consumer havinga percentage of a token in the time-shared resource and the rest of theconsumer represented as a token is in the queue associated with thatresource.

Gating resources, on the other hand, sometimes, by design, do not allowfor either concurrent or time-shared consumption. For instance, acritical section of code may not allow for concurrent execution, inorder to protect against concurrent updates to certain data structures.

That is, code must have permission to access the data. In such a case ofcritical sections, monitors are the key or mechanism for being grantedpermission. Some gating resources restrict access to other resourcepools. A connection pool may be a gate placed before a network resource.That is, potential consumers of that resource must first acquirepermission, by reserving a connection from the connection pool. A threadpool gates access to a collection of resources, including, for example,processors, connections, and critical sections.

In other words, gating resources may not be multiplexed amongstconsumers of the resource, whereas, time-shared resources may bemultiplexed between all aspiring consumers of the time-shared resource.A consumer waiting for permission to pass the gate sits in the queue,idle until the completion of the critical section of the permissionowner of that gating resource.

Therefore, by serving as permission to access other resources, aconsumer of a gating resource may be simultaneously consuming some otherresource. For instance, a consumer owning a monitor will alsosimultaneously be consuming (or aspiring to consume) at least one otherresource, such as waiting to acquire some other monitor, or consuming ashare of network or processor resources.

A sink node 314 may be provided in the system and method of the presentdisclosure. The sink is where a resource consumer may retire once theirwork is completed. By providing a sink, the present inventors haverecognized that model tuning actions can result in a more rapidcompletion of work.

Referring to FIG. 2B, the resource acquisition graph is populated 301with consumers, e.g., tokens as discussed below, of the various nodesand represents the acts of consuming, and waiting for access to aresource. Each token may have two properties: a request type, e.g.,depicted as a triangle, inverted triangle and diamond in FIG. 2B, and ashare, a number of the range of [0, 1].

The owner of a lock is depicted with a dashed line and is shownsimultaneously consuming the lock resource 304 and a share of thenetwork capacity 306 and 308. Tuning actions may result in a change inthe distribution of resources that a request type consumes, but, therequest type stays constant, e.g. by tuning, one does not change oneservlet into another.

A token's share property represents a quantity of consumption of aportion of parallel capacity. A tuning action may change the share of atoken. For example, the owner of a monitor is consuming thecorresponding lock resource 304, whose capacity is 1, with a share of 1the lock owner consumes the entirety of the capacity of that lock 304.The network 308 is a time-shared resource. Assuming it had a capacity of1 and assuming that there is equal sharing, each of the three tokenswould receive a one-third share of that resource.

Referring to back to FIG. 1, at step 112, the system and method of thepresent disclosure may generate a token placement based on the resourceconsumption relation calculated at step 110. The initial placement ofthe tokens is calculated and stored at 114. In one exemplary embodiment,given the consumption relation of step 110, step 112 creates tokens forthe stack samples and whose share has a value of 1, and the token isentered into the resource acquisition graph (e.g., calculated at step128) according to the consumption relation. Clearly high priority tokensmay be given a greater weight that normal or low priority tokens.

While each token may have an initial share value of 1, the tokens willexist in proportion to their frequency of occurrence in the sample. Inone exemplary embodiment, effects such as thread priorities are ignored,however, in another exemplary embodiment, effects such as threadpriorities are taken into account. As discussed above, it is possiblethat one sample may not be representative of the overall behavior ofthat request type. Accordingly, it may be preferable to acquire aplurality of samples.

In addition, at step 112, the system and method of the presentdisclosure may populate the resource acquisition graph based on one ormore invariants.

For example, a capacity constraint invariant may help to ensure that thesum of the shares of the tokens consuming a resource does not exceed thecapacity of the resource. In addition, a maximal utilization invariantmay allow the queue to be empty if the sum of the shares of the tokensconsuming the resource is less than 1. A fairness invariant may help toensure that the capacity of a resource is fairly shared across therequest types of the tokens consuming the resource.

In order to maintain these invariants, the Generate Token Placement 512may split or rebalance the tokens. For example, once the initial tokenplacement is performed at step 114, time-shared resources may besaturated. To reestablish the share invariants, the system and method ofthe present disclosure may return to step 112 and split and rebalancethe tokens to place them into the queue of the resource.

For example, assuming that K tokens have been placed in a time-sharedresource with capacity C, and that the shares of these tokens are c₁, .. . , c_(k) and that j tokens have been placed in the correspondingqueue, with shares q₁, . . . , q_(j). If, Σc_(i)>C, then the capacityconstraint invariant does not hold. As a result, the token populatingmodule may automatically split each of the consuming tokens c_(i) intotwo tokens, each with the same request type as the original. The shareof the two new tokens is then c′_(i) and q′_(i), the new consuming andqueued shares c′_(i)=C/k, assuming that the time-shared resource will bemultiplexed without bias to the consumers of the resources,q′_(i)=c_(i)−c′_(i), i.e., the queued token may be left with theresidual share. In other words, the Token Populating Module 402 movesthe q′_(i) token to the respective queue node. If, on the other hand,Σc_(i)<C and j>0, then the maximal utilization invariant does not hold.Accordingly, the Token Populating Module 402 may reestablish the maximalutilization invariant through an analogous splitting and moving process.In such a case, the tokens will automatically flow from the queue nodeto the respective resource node.

As noted above, Gating resource pools the distinct property that theowner of a shared of the pool may simultaneously consume some otherresource. As is shown in FIG. 2B, the token owning the gating resource304 is also consuming other resources. This is a feature of the locked(e.g., dashed) token only, the other tokens are each distinct from theother tokens, even the tokens have the same resource type (e.g., shape).Clearly, however, there may be more than one locked token. Thisinter-token relationship allows the system and method of the presentdisclosure to more accurately model the affect of a tuning action. Forexample, the token in the gating resource 304 is also consuming theprocessing power of the network and queue 308 and 306 respectively.Therefore, increasing the speed of the code of the token in the gatingresource may reduce the consumption of the time-shared resource and alsoallow the process in the gating resource to complete more quickly.

As noted above, a tuning action, such as adding processors oralleviating lock contention, may or may not increase performance of thesystem. That is, the benefit of tuning some aspect of the system dependson whether a latent performance issue will surface as a consequence ofthe tuning action, e.g., reducing a degree of contention for a gatingresource may only increase the demand placed on a time-sharing resource.This is especially the case when the tokens of the gating resourceconsume a large portion of the time-shared resource.

The present inventors have realized that by acquiring snapshot samplesof the execution state as a moment in time can give a resourceacquisition graph (e.g., a queuing network model). A snapshot does notexpress any control flow properties.

The present inventors have also recognized that a consumed-afterrelation, which is a one-to-many correspondence between resources thatindicates those resources that are likely to be consumed temporallyafter a given resource. In one exemplary embodiment, one consumed-afterrelation is considered per request type.

Since the set of resources consumed and the order in which they are usedvaries from one request type to the next, a global consumed-afterrelation that spans the entire application may overestimate the set oflatent bottlenecks. Accordingly, in one exemplary embodiment of thepresent disclosure, the system and method may infer the consumed-afterrelation by observing, for each request type, the a priori distributionof resources consumed during any execution of that request.

That is, according to the present disclosure it may be inferred whichresource will be consumed next by following a probability distributiongiven by that request type's consumption relation.

Referring to FIG. 3, in one exemplary embodiment of the presentdisclosure, the queuing network model generated at step 128 is provided.At step 430, a tuning action set is extracted and possible tuningactions are calculated at step 432.

At step 434, one or more tuning actions are chosen and applied at step436 to the queuing network model 128. The chosen tuning action(s)updates the initial placement of tokens 114 in the queuing network model128 to an updated placement of tokens 438.

The initial placement of tokens 114 and the updated placement of tokens438 are used to generate a benefit at step 440. At step 442, the benefitgenerated at step 440 is used to generate an expected benefit of theapplied tuning action chosen at step 434.

A potential benefit of a tuning action relates to the latency (servicetime, time-to-completion, or response time, etc.) of the flow ofrequests through the system. For batch applications, this single metricmay be sufficient, and identical to the time-to-completion of theapplication (and any of its phases).

For server applications, request time is often of primary importance.The quality of service of a web page is often judged in this way. Asecond metric, throughput, is also important, but often less so. In asteady state, where requests are not backlogging, the latency ofrequests is only different from the rate of incoming requests if thereare non-modeled upstream bottlenecks; e.g. a problem on the load drivingmachines, in a testing scenario.

As noted above, some conventional devices propose tuning actions thatare merely a trade off increased response time in one request type for areduction in others, even going so far as being zero sum games. Thesystem and method of the present disclosure, however, shows how aninspection of the placement of tokens in a resource acquisition graphindicates the effect of a set of tuning actions on performance.

For example, when looking at a single sample, an application makesforward progress via the completion of requests. The only way tocomplete a request is by, eventually, executing code on a processor. Ifa thread spends forever waiting for a resource to become available (suchas would be the case in a deadlock situation), response time will beinfinite. Accordingly, the present inventors have realized that it maybe beneficial to associate a benefit with the request type.

The system and method in an exemplary embodiment of the presentdisclosure can capture the effect of completing requests on performance.For example, the system and method can measure Goodness of a requesttype c, a reflection of the time to complete requests of that type, byconsidering the sum of token shares, of that request type, eitherconsuming the resource K or as demand on the sink D, as follows:

Goodness(c)=K(c)+D(c)

At step 440, a benefit of a given tuning action may be generated by aratio of Goodness, considered before and after applying the tuningaction (e.g., the initial token placement 114 and the updated tokenplacement 438, respectively). If Goodness'(c) is the value after tuning,then the system and method can calculate the benefit of the tuningaction of the request type c as:

${{Benefit}(c)} = \frac{{Goodness}(c)}{{Goodness}(c)}$

A tuning action is beneficial with respect to request type c if Benefit(c) above a predetermined threshold and harmful if below thepredetermined threshold, and otherwise considered neutral. In anexemplary embodiment, the predetermined threshold is 1.

Such a request type specific accounting exposes zero-sum gains. Sometuning actions, such as, for example, adding addition CPUs, may resultin decreased resource, e.g., CPU consumption, and yet should still beconsidered as benefits. The system and method of the present disclosuremay account for this by including in the benefit the sum of token sharesthat are in the sink node as a result of the tuning action.

In another exemplary embodiment of the present disclosure, the systemand method of the present disclosure can compute the per-request typeand net benefits across multiple samples. For example, given a set ofsamples and a tuning action, the system and method of the presentdisclosure may compute the per-request type benefit of a tuning actionfor each sample. To compute the per-request type benefit and net benefitacross the samples, the system and method of the present disclosure maytake the harmonic of the respective values. In one exemplary embodiment,the harmonic mean is used. This may exaggerate the effect of harm.

In another exemplary embodiment of the present disclosure, the systemand method of the present disclosure may automatically detect aplurality of bottlenecks. In this embodiment, problems (e.g.,bottlenecks) in the system may be prioritized based on where eachproblem is ranked according to a benefit achieved by applying a tuningaction that renders the resource free.

For example, referring to FIG. 4A, a similar system and method to thatof FIG. 3 is provided. However, in this embodiment, the tuning actionsmay be prioritized at step 544. When a plurality of tuning actions arechosen to be applied, the expected benefit of each tuning action iscalculated at step 442 and the plurality of expected tuning benefits areprioritized at 544 based on the expected benefit of the tuning actions.

Referring to FIG. 4B, in one exemplary embodiment, one or morelow-priority tuning actions may be extracted at step 546 from the set oftuning actions prioritized tuning at step 544 and stored at step 548. Alow-priority tuning action may be a infrequency event. In one exemplaryembodiment, the one or more low-priority tuning actions stored at step548 may be analyzed at step 550 to determine why the priority is low. Ifa low-priority tuning action stored at step 548 is determined to below-priority due to infrequent event (e.g., a lock with few threadswaiting on it) at step 550, then the low-priority tuning action may beclassified as such at step 552.

On the other hand, if a low-priority tuning action stored at 548 isdetermined to be low-priority due to a latent bottleneck, then thelow-priority tuning action is classified as such at step 554. Thisfeature may be beneficial because there may be many threads affected bythis tuning action; however, the tuning action may have no effect onperformance. For example, if the tuning action is to remove a lock;however, the successor to the lock in the resource acquisition graph isanother lock, then removing the first lock will cause all the threadswaiting on that lock to wait on the successor lock.

In one exemplary embodiment, at step 556, the system and method of thepresent disclosure can feedback, to the choose tuning action step at434, the low-priority tuning actions stored that have been determined tobe low priority due to latent bottlenecks at step 554. This feature isbeneficial because this feature may allow the system and method of thepresent disclosure to choose another tuning action. This process may beiterated until no more tuning actions are determined to be low-prioritydue to a latent bottleneck.

In another exemplary embodiment, one or more plans of action may beformed, e.g., sets of tuning actions, that together accomplish an evengreater benefit may be applied to the queuing network model. Forexample, if lock contention is a frequent occurrence, but the system hasrelatively few processors, then when considering only individual tuningactions tuning the lock contention will have limited benefit onperformance because of the relative few processors and tuning theprocessor will have limited benefit because the CPU is not fullyutilized. However, when one or more plans of action are considered thenthe system and method may be optimized through one or more iterations oftuning until a greatest benefit is achieved.

The system and method of the present disclosure may tune one or moreaspects of the system thereby resulting in a shift in the way resourcesare consumed by the tokens. Adding processors to the system, forexample, will result in an increase in the portion that each aspiringtoken receives. Eliminating a source of a lock contention will result ina shift, form waiting to enter a critical section to consuming thesubsequent resources, as given by the consumed-after relation.

According to an exemplary embodiment of the present disclosure, a tuningaction applied at step 436 in FIG. 4A may have two consequences on thedistribution of tokens. First, as a result of completing work morequickly, tokens may escape, e.g., free-up, a resource. Second, whentokens enter a time-shared resource, a token split-and-rebalance mayoccur as a consequence of increased demand.

A tuning action may induce at least two tokens, e.g., the escaping tokenand the residual token, for example, the token that flows to asubsequent resource according to consumers-after and the token thatremains in the resource, respectively. Sets of the escaping token(s) andthe residual token(s) can be executed for different classes of tuningactions. For example, tuning actions that change an execution speed,e.g., accomplished by changing code or the resources themselves, tuningactions that change the parallel capacity of time-shared resources, andthose that introduce nascent consumers into the system.

A difference between speed increases and capacity increases lies in theshape of the performance curves. As parallel capacity is added, a lineardecrease in service time, up until demand exceeds capacity may result.

In contrast, as execution speed increases, an asymptotic decrease inservice time may result. There is also a commonality between speedincreases and capacity increases. For example, increasing parallelcapacity may also result in requests completing more quickly.

A change in processor speed or disk access time may change the latencyrequired to accomplish a given task on that resource. Threads that wouldhave, prior to the tuning action, been observed consuming that resourcewill be more likely to be observed, subsequent to tuning, consuming theresource given by the consumed-after relation. Changing the speed of aresource is an action that may affect all resource types equally.

Code tuning has a similar affect on time to completion, but is focusedon individual request types of tokens. For example, tuning a particularrequest type to make more efficient database queries may result indecreased demand for the remote data source and increased demand for thesubsequent resources. The affected tokens may be restricted to those ofthat request type.

Therefore, adjustments to speed can be modeled in the system and methodof the present disclosure by moving tokens from one resource to one ormore successor resources, according a consumed-after relationship. Thesystem and method of the present disclosure may predict an increase insamples observed “downstream” of that resource and that predict theresulting length of the queue.

Every tuning action may have an effected set of tokens. Tuning actionsthat pertain to resources affect every token in that resource or thatresource's associated queue, while tuning actions focused on a requesttype affect only tokens of that request type. Given an effected set oftokens M, the demand of M, D_(M) is the sum of token shares, across alltoken in M. The demand for a resource is that D_(M) where M consists oftokens placed there. Each resource also has a parallel capacity C.

As the speedup factor increases, the fraction of tokens escapingasymptotically approaches 1. Given a resource r, and a speed increase offactor f, the value e_(f), representing the fraction of token sharesthat escape from r, is given by:

e _(f)=1−1/f

If demand exceeds increased capacity, then the system and method mayexpect to see a decrease in demand proportional to the increase incapacity, gC−C. The fraction by which future observations diminish maythus given by this number divided by D. If demand does not exceedincreased capacity, then the same argument holds, except that thedecrease in demand is bounded by the actual demand: D−C.

The escape ratio, due to capacity increases, implies a speedup factor.The plurality of tuning actions and determine whether one or morelow-priority tuning actions are low-priority due to an infrequent eventor due to a latent bottleneck.

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s).

It should also be noted that, in some alternative implementations, thefunctions noted in the block may occur out of the order noted in thefigures. For example, two blocks shown in succession may, in fact, beexecuted substantially concurrently, or the blocks may sometimes beexecuted in the reverse order, depending upon the functionalityinvolved. It will also be noted that each block of the block diagramsand/or flowchart illustration, and combinations of blocks in the blockdiagrams and/or flowchart illustration, can be implemented by specialpurpose hardware-based systems that perform the specified functions oracts, or combinations of special purpose hardware and computerinstructions.

FIG. 5A illustrates a typical hardware configuration 600 which may beused for implementing the system and method of automatically identifyinga primary bottleneck in a computer system without any using an userdefined parameters. The configuration has preferably at least oneprocessor or central processing unit (CPU) 610. The CPUs 610 areinterconnected via a system bus 612 to a random access memory (RAM) 614,read-only memory (ROM) 616, input/output (I/O) adapter 618 (forconnecting peripheral devices such as disk units 621 and tape drives 640to the bus 612), user interface adapter 622 (for connecting a keyboard624, mouse 626, speaker 628, microphone 632, and/or other user interfacedevice to the bus 612), a communication adapter 634 for connecting aninformation handling system to a data processing network, the Internet,an Intranet, a personal area network (PAN), etc., and a display adapter636 for connecting the bus 612 to a display device 638 and/or printer639. Further, an automated reader/scanner 641 may be included. Suchreaders/scanners are commercially available from many sources.

In addition to the system described above, a different aspect of theinvention includes a computer-implemented method for performing theabove method. As an example, this method may be implemented in theparticular environment discussed above.

Such a method may be implemented, for example, by operating a computer,as embodied by a digital data processing apparatus, e.g., a computerprogram product, to execute a sequence of machine-readable instructions.These instructions may reside in various types of storage media. Forexample, the computer program product may comprise media, for examplehard disks, a compact storage medium such as a compact disc, or otherstorage devices, which may be read by the processing unit by anytechniques known or will be known to the skilled artisan for providingthe computer program product to the processing system for execution.

The computer program product may comprise all the respective featuresenabling the implementation of the methodology described herein, andwhich—when loaded in a computer system—is able to carry out the methods.Computer program, software program, program, or software, in the presentcontext means any expression, in any language, code or notation, of aset of instructions intended to cause a system having an informationprocessing capability to perform a particular function either directlyor after either or both of the following: (a) conversion to anotherlanguage, code or notation; and/or (b) reproduction in a differentmaterial form.

Thus, this aspect of the present invention is directed to a programmedproduct, including storage media tangibly embodying a program ofmachine-readable instructions executable by a digital data processor toperform the above method.

Such a method may be implemented, for example, by operating the CPU 610to execute a sequence of machine-readable instructions. Theseinstructions may reside in various types of storage media.

Thus, this aspect of the present invention is directed to a programmedproduct, including storage media tangibly embodying a program ofmachine-readable instructions executable by a digital data processorincorporating the CPU 610 and hardware above, to perform the method ofthe invention.

This storage media may include, for example, a RAM contained within theCPU 610, as represented by the fast-access storage for example.Alternatively, the instructions may be contained in another storagemedia, such as a magnetic data storage diskette 601 or compact disc 602(FIG. 5B), directly or indirectly accessible by the CPU 610.

Whether contained in the computer server/CPU 610, or elsewhere, theinstructions may be stored on a variety of machine-readable data storagemedia, such as DASD storage (e.g., a conventional “hard drive” or a RAIDarray), magnetic tape, electronic read-only memory (e.g. ROM, EPROM, orEEPROM), an optical storage device (e.g., CD-ROM, WORM, DVD, digitaloptical tape, etc.), paper “punch” cards, or other suitable storagemedia. In an illustrative embodiment of the invention, themachine-readable instructions may comprise software object code,compiled from a language such as C, java, etc.

While the invention has been described in terms of several exemplaryembodiments, those skilled in the art will recognize that the inventioncan be practiced with modification within the spirit and scope of theappended claims.

Further, it is noted that, Applicant's intent is to encompassequivalents of all claim elements, even if amended later duringprosecution.

What is claimed is:
 1. A method for automatically gauging a benefit of atuning action, the method comprising: collecting a plurality ofobservations of a running state of a plurality of threads in a computersystem, as executed by a processor in a computer system; identifying aplurality of resources the computer system and a capacity of eachresource of the plurality of resources; mapping an observation of therunning state of each thread of the plurality of threads to a resourcethat the observation of each thread uses, respectively; and applying thetuning action to a first resource of the plurality of resources todetermine an impact on the performance of the computer system.
 2. Themethod according to claim 1, wherein the plurality of observationscomprise a call stack of a thread.
 3. The method according to claim 1,wherein the plurality of observations comprises lock graph indicating athread that owns a lock and whether another thread is queued to own thelock.
 4. The method to claim 1, further comprising changing a capacityof the first resource, based on the tuning action.
 5. The methodaccording to claim 1, further comprising changing a speed of the firstresource, based on the tuning action.
 6. The method according to claim1, further comprising changing a speed of an observation of theplurality of observations, based on another tuning action.
 7. The methodaccording to claim 1, further comprising increasing a number ofobservations to increase a load of the first resource.
 8. The methodaccording to claim 4, further comprising determining a change inperformance when the capacity of first resource is changed.
 9. Themethod according to claim 5, further comprising determining a change inperformance when the speed of first resource is changed.
 10. The methodaccording to claim 1, further comprising automatically identifying aprimary bottleneck in the computer system without using any user definedparameters, based on the gauged benefit of the tuning action.
 11. Themethod according to claim 1, further comprising automatically generatinga queuing network model based on the plurality of observations, theplurality of resources of the computer system, and a capacity of eachresource of the plurality of resources.
 12. The method according toclaim 1, further comprising: applying a plurality of tuning actions toplurality of resources; and determining an impact on the performance ofthe computer system based on each tuning action of the plurality oftuning actions.
 13. The method according to claim 1, wherein the tuningaction applied to the first resource comprises a set of tuning actions,the method further comprising prioritizing the set of tuning actionsbased on a determined impact on the performance of the computer system.14. The method according to claim further comprising: determining if atuning action of the set of tuning actions is low-priority due to abottleneck at a second resource downstream of the first resource; andchoosing another tuning action of the set of tuning actions to beapplied to the first resource, when the tuning action is low-prioritydue to a bottleneck at the second resource.
 15. A computer readablestorage medium storing a program of instructions to executable by amachine to perform a method of automatically gauging a benefit of atuning action, the method comprising: collecting, via a processor,information associated with a runtime execution of a computer system;and generating, via the processor, a plurality of queuing network modelsbased on one or more execution states of one or more threads within aprogram running on the processor; calculating, via the processor, aplurality of possible tuning actions; and applying a tuning action ofthe plurality of tuning actions to the plurality of queuing networkmodels.
 16. The computer readable storage medium according to claim 15,further comprising collecting the information associated with theruntime execution of the computer system at periodic intervals.
 17. Thecomputer readable storage medium according to claim 15, furthercomprising: calculating, via the processor, a set of tuning actions; andprioritizing the set of tuning actions.
 18. The computer readablestorage medium according to claim 15, further comprising: applying eachtuning action of the set of tuning actions to a first node of thenetwork queuing model; and determining if a priority of one or moretuning actions of the set of tuning actions is affected by a second nodein the network queuing model.
 19. The computer readable storage mediumaccording to claim 15, further comprising changing a speed of a resourceof the computer system, based on the tuning action.
 20. The computerreadable storage medium according to claim 15, further comprisingchanging a capacity of a resource of the computer system, based on thetuning action.
 21. The computer readable storage medium according toclaim 15, further comprising changing a speed of an observation of thecomputer system, based on the tuning action.
 22. The computer readablestorage medium according to claim 15, further comprising changing thenumber of observations of the computer system, based on the tuningaction.
 23. The computer readable storage medium according to claim 15,further comprising calculating an expected benefit of the tuning actionof the plurality of tuning actions based on an initial placement oftokens in the queuing network model and a placement of tokens in thequeuing network model after the tuning action.
 24. The computer readablestorage medium according to claim 23, wherein the expected benefit isfurther calculated based on a set of tuning actions and a net benefitthereof.
 25. A computer readable storage medium storing a program ofinstructions executable by a machine to perform a method of gauging abenefit of a tuning action, the method comprising: acquiring a set oftime series data sampled from an environment of an application, using aprocessor; identifying a plurality of resources of a computer system;identifying request types of the set of time series data sampled fromthe environment of the application; extracting a plurality of monitorsfrom the set of time series data sampled from the environment of theapplication; and generating an instance of a queuing network model,based on the plurality of resources of the computer system, the requesttypes of the set of time series data sampled from the environment of theapplication, and the plurality of monitors extracted from the set oftime series data sampled from the environment of the application. 26.The computer readable storage medium according to claim 25, furthercomprising: choosing a set of tuning actions from a plurality of tuningactions; applying each tuning action of the set of tuning actions to afirst resource of the plurality of resources; and prioritizing eachtuning action of the set of tuning actions, based on a determinedbenefit of each tuning action respectively.
 27. The computer readablestorage medium according to claim 26, further comprising: extracting oneor more low-priority tuning actions of the set of tuning actions; anddetermining if the one or more low-priority tuning actions arelow-priority due to a bottleneck at a second resource downstream fromthe first resource.
 28. The computer readable storage medium accordingto claim 25, further comprising: choosing a set of tuning actions from aplurality of tuning actions; applying one or more tuning actions of theset of tuning actions to more than one resource of the plurality ofresources; and prioritizing each tuning action of the set of tuningactions based on a determined benefit of each tuning actionrespectively.
 29. The computer readable storage medium according toclaim 28, further comprising: extracting one or more low-priority tuningactions of the set of tuning actions; and determining if the one or morelow-priority tuning actions are low-priority due to a bottleneck at asecond resource downstream from the first resource.